﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using DeepEarth.Core;
using DeepEarth.Map.Core;
using DeepEarth.Map.Core.Extension;
using DeepEarth.Toolkit.Geometry;
using DeepEarth.Toolkit.Geometry.Data;

namespace DeepEarth.Toolkit.Drawing
{
    public class PushpinDrawProcessor : PointDrawProcessor
    {
        public PushpinDrawProcessor(UIElement interactionSurface, Panel drawingSurface, Func<Location, Point> locationToViewportPoint, Func<Point, Location> viewportPointToLocation)
            : base(interactionSurface, drawingSurface, locationToViewportPoint, viewportPointToLocation)
        {
            RenderedElement = new PushpinIcon();
            PositionOrigin = PositionOrigin.BottomCenter;
        }

        protected override void DrawComplete(Location l)
        {
            PushpinGeometry pointGeometry = new PushpinGeometry();
            pointGeometry.Position = l;

            OnDrawComplete(pointGeometry);
        }

        public FrameworkElement Icon
        {
            get
            {
                return RenderedElement;
            }
            set
            {
                RenderedElement = value;
            }
        }
    }
}
